﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

using HR_Interfaces;

namespace EmployeeApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btn_Click(object sender, EventArgs e)
        {
            try
            {
                gv.DataSource = iem.searchByQualification(txt.Text);
              //gv.DataSource = iem.getAllEmployees();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        IEmployee iem = null;
        private void btn_connect_Click(object sender, EventArgs e)
        {
            try
            {
                TcpChannel channel = new TcpChannel();
                string url = "tcp://" + txt_ip.Text + ":" + txt_port.Text + "/EMRemoteObject";

                iem = (IEmployee)Activator.GetObject(typeof(IEmployee), url);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }


    }
}
